
cmake_minimum_required(VERSION 3.18.0)

get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME_WE)

project(${PROJECT_NAME} LANGUAGES C CXX VERSION 1.0.0)

set(CMAKE_CXX_STANDARD 11)
set(USE_FOLDERS ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY  ${PROJECT_SOURCE_DIR}/lib)
set(CMAKE_CONFIGURATION_TYPES "Release;Debug")
set(CMAKE_DEBUG_POSTFIX "d")
add_compile_options(/MP)

set(QT6_ROOT "" CACHE PATH "qt 6 root dir")
if(NOT EXISTS ${QT6_ROOT})
    message(FATAL_ERROR "QT6_ROOT=${QT6_ROOT}")
endif()
list(APPEND CMAKE_PREFIX_PATH ${QT6_ROOT})
find_package(Qt6 REQUIRED COMPONENTS Core Widgets Gui Quick CONFIG PATHS ${QT6_ROOT})

set(OSG_DIR "" CACHE PATH "osg root dir")
if(NOT EXISTS ${OSG_DIR})
    message(FATAL_ERROR "OSG_DIR=${OSG_DIR}")
endif()

set(OSGEARTH_DIR "" CACHE PATH "osgEarth root dir")
if(EXISTS ${OSGEARTH_DIR})
    find_package(osgEarth REQUIRED COMPONENTS osgEarth CONFIG PATHS ${OSGEARTH_DIR} NO_DEFAULT_PATH)
endif()

find_package(OpenSceneGraph REQUIRED COMPONENTS osg osgViewer osgGA osgDB)

add_subdirectory(src)